<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="verydows-baseurl" content="<{$common.baseurl}>">
<title>申请售后 - <{$GLOBALS.cfg.site_name}></title>
<link rel="stylesheet" type="text/css" href="<{$common.theme}>/css/general.css" />
<link rel="stylesheet" type="text/css" href="<{$common.theme}>/css/user.css" />
<link rel="stylesheet" type="text/css" href="<{$common.theme}>/css/service.css" />
<script type="text/javascript" src="<{$common.baseurl}>/public/script/jquery.js"></script>
<script type="text/javascript" src="<{$common.theme}>/js/general.js"></script>
<script type="text/javascript">
$(function(){
  $('#goods_qty').keyup(function(){
    var $val = $(this).val(), $max = $(this).data('max');
    if(!/(^[1-9]\d*$)/.test($val) || $val > $max){
      alert('输入数量无效或超过您所购买的商品数量');
      $(this).val($max).focus();
    }
  });
});

function clickQtyBtn(operate){
  var qty = $('#goods_qty'), qty_val = parseInt(qty.val()), qty_max = qty.data('max');
  if(operate == 'incr'){
    if(qty_val + 1 <= qty_max) qty.val(qty_val + 1); else alert('不能超过您所购买的商品数量');
  }
  else{
    if(qty_val - 1 > 0) qty.val(qty_val - 1); else alert('数量不能小于1');
  }
}

function submitApply(){
  var form = $('#apply-form');
  form.find('textarea[name="cause"]').vdsFieldChecker({rules:{required:[true, '请输入原因描述'], minlen:[15, '原因描述不能少于15个字符'], maxlen:[500, '原因描述不能超过500个字符']}, tipsPos:'br'});
  form.find('input[name="mobile"]').vdsFieldChecker({rules:{required:[true, '请输入手机号码'], mobile:[true, '手机号码无效']}});
  form.vdsFormChecker();
}
</script>
</head>
<body>
<!-- 顶部开始 -->
<{layout_topper common=$common}>
<!-- 顶部结束 -->
<!-- 头部开始 -->
<{layout_header common=$common}>
<!-- 头部结束 -->
<div class="loc w1100">
  <div><a href="<{url c='main' a='index'}>">网站首页</a><b>&gt;</b><font>售后服务</font></div>
</div>
<!-- 主体开始 -->
<div class="container w1100 mt10">
  <div class="module cut">
    <!-- 左侧开始 -->
    <div class="w180 fl cut">
      <!-- 用户菜单开始 -->
      <{layout_usermenu}>
      <!-- 用户菜单结束 -->
    </div>
    <!-- 左侧结束 -->
    <!-- 右侧开始 -->
    <div class="w910 cut">
      <div class="mcter">
        <h2>申请售后</h2>
        <form method="post" action="<{url c='aftersales' a='apply' step='submit'}>" id="apply-form">
          <input type="hidden" name="order_id" value="<{$goods.order_id}>" />
          <input type="hidden" name="goods_id" value="<{$goods.goods_id}>" />
          <div class="pad10 cut">
            <h3 class="pad10 aln-c f14 c666">申请退换货的商品信息</h3>
            <div class="tli cut">
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <th colspan="2">商品</th>
                  <th width="180">选择数量</th>
                  <th width="150">金额</th>
                </tr>
                <tr>
                  <td width="80"><a href="<{url c='goods' a='index' id=$goods.goods_id}>"><img src="<{$common.baseurl}>/upload/goods/prime/50x50/<{$goods.goods_image}>" /></a></td>
                  <td>
                    <p class="aln-l"><a href="<{url c='goods' a='index' id=$goods.goods_id}>"><{$goods.goods_name}></a></p>
                    <{if !empty($goods.goods_opts)}>
                    <p class="aln-l c999 mt5"><{foreach $goods.goods_opts as $o}><span class="mr5">[<{$o.opt_type}>: <font class="c666"><{$o.opt_text}></font>]</span><{/foreach}></p>
                    <{/if}>
                  </td>
                  <td class="qty">
                    <button type="button" onclick="clickQtyBtn('decr')">-</button><input name="goods_qty" id="goods_qty" class="aln-c" type="text" value="<{$goods.goods_qty}>" data-max="<{$goods.goods_qty}>" /><button type="button" onclick="clickQtyBtn('incr')">+</button>
                  </td>
                  <td><{$goods.goods_price}></td>
                </tr>
              </table>
            </div>
            <div class="ptform mt10 pad10 aln-l">
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <th width="120">期望处理类型：</th>
                  <td>
                    <label><input name="type" type="radio" value="0" checked="checked" /><font class="ml5">报修</font></label>
                    <label class="ml10"><input name="type" type="radio" value="1" /><font class="ml5">换货</font></label>
                    <label class="ml10"><input name="type" type="radio" value="2" /><font class="ml5">退货</font></label>
                  </td>
                </tr>
                <tr>
                  <th>原因描述：</th>
                  <td><textarea class="txt" name="cause" cols="60" rows="6"></textarea></td>
                </tr>
                <tr>
                  <th>您的手机号码：</th>
                  <td><input class="w150 txt" name="mobile" type="text" /></td>
                </tr>
                <tr>
                  <td colspan="2"><div class="ptform-btn"><button type="button" class="sm-blue" onclick="submitApply()">提交申请</button></div></td>
                </tr>
              </table>
            </div>
          </div>
        </form>
      </div>
    </div>
    <!-- 右侧结束 -->
  </div>
  <div class="cl"></div>
  <{layout_helper}>
</div>
<!-- 主体结束 -->
<div class="cl"></div>
<!-- 页脚开始 -->
<{layout_footer}>
<!-- 页脚结束 -->
<script type="text/javascript" src="<{$common.baseurl}>/public/script/juicer.js"></script>
</body>
</html>